import 'package:fijkplayer/fijkplayer.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:leader_help/utils/img_util.dart';

import 'config/CustomFijkPanel.dart';
import 'logic.dart';

class VideodetailPage extends StatelessWidget {
  final logic = Get.put(VideodetailLogic());
  final state = Get.find<VideodetailLogic>().state;

  @override
  Widget build(BuildContext context) {
    logic.loadUrl();

    return AnnotatedRegion<SystemUiOverlayStyle>(
      value: SystemUiOverlayStyle.dark,
      child: Scaffold(
          backgroundColor: Colors.grey[350],
          // appBar: TopAppBar('视频详情'),
          body: Column(
            children: [
              FijkView(
                height: 250.h,
                color: Colors.black,
                fit: FijkFit.cover,
                player: state.player,
                panelBuilder: (
                  FijkPlayer player,
                  FijkData data,
                  BuildContext context,
                  Size viewSize,
                  Rect texturePos,
                ) {
                  return CustomFijkPanel(
                    player: player,
                    viewSize: viewSize,
                    texturePos: texturePos,
                    videoTitle: "视频标题",
                    buildContext: context,
                    onBack: () {
                      Navigator.pop(context); // 如果需要做拦截返回则在此判断
                    },
                  );
                },
              ),
            ],
          )),
    );
  }
}
